<template>
	<!-- allocationrecord调拨记录 -->
	<view class="a_list">
		<view class="a_item" v-for="(item,index) in list" :key="index">
			<view class="a_title">
				从<text>{{item.fromsup}}</text>调拨至<text>{{item.tosup}}</text>
			</view>
			<view class="a_info">
				<view>调拨人：<text>{{item.nickname}}</text></view>
				<view class="a_time">{{item.createtime}}</view>
			</view>
			<view>调拨金额：<text class="a_credit">{{item.credit}}</text>米币</view>
		</view>
		<view class="a_loading_empty">
			<image v-if="isloading" src="../../static/business/loading.gif" mode=""></image>
			<text v-if="isempty">到底了~</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 0,
				list: [],
				isloading: false,
				isempty: false,
			}
		},
		onReachBottom() {
			this.getList();
		},
		onLoad() {
			this.getList();
		},
		methods: {
			getList() {
				this.page++;
				this.isloading = true;
				this.$axios('groupCredit/creditlog', 'POST', 'supplier', {
					page: this.page
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						let length = res.data.data.length;
						this.list = this.list.concat(res.data.data);
						this.isempty = length <= 0 ? true : false;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f2f2f2;
		color: $font-color-dark;
		padding-bottom: 120upx;
	}

	.a_list {
		overflow: hidden;
	}

	.a_item {
		background-color: #fff;
		margin-top: 20upx;
		padding: 20upx;
		line-height: 50upx;
	}

	.a_title,
	.a_info {
		display: flex;
		align-items: center;
	}

	.a_title text {
		font-weight: bold;
	}

	.a_time {
		padding-left: 40upx;
	}

	.a_info text {
		font-weight: bold;
	}

	.a_credit {
		color: #FF0000;
	}

	.a_loading_empty {
		color: $font-color-spec;
		padding: 40upx;
		text-align: center;
	}

	.a_loading_empty image {
		height: 50upx;
		width: 50upx;
	}
</style>
